import QtQuick 2.0
import QtGraphicalEffects 1.14

Rectangle {
    property Item m_source
    property bool m_dragable:  true //未使用
    property color border_color: "transparent"
    property int border_radius: 10
    property int blur_radius: 32
    id:blur_rect
    width: 100
    height: 100
    radius: border_radius
    clip: true
    MouseArea {
         anchors.fill: parent
         drag.target: parent
         drag.axis:  Drag.XAndYAxis
     }

    Rectangle{
        id:blur_1
        anchors.fill: parent
        clip: true
        visible:false
        FastBlur{
            id:blur
            width: m_source.width
            height: m_source.height
            source:m_source
            x:-blur_rect.x
            y:-blur_rect.y
            radius: blur_radius
        }
    }

    Rectangle{//遮罩
        id:mask
        anchors.centerIn: parent
        width: parent.width+2//+2 去掉边缘遮罩层边缘漏色，不知道为啥??
        height: parent.height+2
        color: "red"
        radius: border_radius
        visible: false
    }

    OpacityMask {
            anchors.fill: mask
            source:blur_1
            maskSource:mask
    }

    Rectangle{//边框
        anchors.fill: parent
        border.color: border_color
        border.width: 1
        color: "transparent"
        radius: border_radius
    }
}

